﻿<%@ WebHandler Language="C#" Class="Uploader" %>

using System;
using System.IO;
using System.Web;

public class Uploader : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        HttpPostedFile oFile = context.Request.Files["Filedata"];
       
       
        
       context.Response.ContentType = "text/plain";
        //context.Response.Write(oFile);


        if (oFile != null)
        {
            const string sDirectory = @"E:\\web\septembe\uploads\";
            //if (!Directory.Exists(sDirectory))
                //Directory.CreateDirectory(sDirectory);

            try
            {
                oFile.SaveAs(Path.Combine(sDirectory, oFile.FileName));
            }
            catch (Exception e)
            {
                context.Response.Write(e.Message);
            }
            context.Response.Write("1");
        }
        else
        {
            context.Response.Write("0");
        }
    }    
    
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}